﻿Public Class FormTypeEditer

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Cmd.Parameters("@TypeName") = Me.txtName.Text
        If txtId.Text <> "" Then
            Button1.Text = "កែប្រែ"
            Cmd.Parameters("@TypeId") = txtId.Text
            Cmd.ExecuteNonQuery("update Type set TypeName=@TypeName where TypeId=@TypeId")
        Else
            Cmd.ExecuteNonQuery("insert into Type values (@TypeName,1)")
        End If
        Me.DialogResult = Windows.Forms.DialogResult.OK
        FormType.LoadData()
    End Sub

    Private Sub FormTypeEditer_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class